package com.ccbooks.util;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException; //import java.util.Date;
import java.util.Date;

import com.ccbooks.dao.BooksDao;
import com.ccbooks.dao.DBHelper;
import com.ccbooks.util.PDB.ContentUtilZeroPDB;
import com.ccbooks.view.BookContentView;
import com.ccbooks.vo.Book;

import android.content.ContentValues;
import android.content.Context;
import android.graphics.Typeface;

//import javax.swing.JLabel;

/**
 * 
 * @author Administrator
 * 
 */

public class BooksEngine {

	private final static int MAX_LINE_NUM = 1024 * 100;
	private final static int MAX_BUF_SIZE = 80;
	private final static int MAX_ZERO_NUM = 3000;

	private InputStreamReader inputStreamReader = null;
	private static InputStreamReader inputStreamReader2 = null;
	public Font font = null;

	public int screenWidth;
	public static int[] lineIndex = new int[MAX_LINE_NUM];
	public int[] lineIndex2 = new int[MAX_LINE_NUM];
	public static int[] lineIndex3 = new int[MAX_ZERO_NUM];
	public static int[] lineIndex4 = new int[MAX_ZERO_NUM];
	public int curLine2 = 0;
	public int curLine4 = 0;
	public static int curLine = 0; // 文件总行数(通过计算);
	public int curLine3 = 0;
	public int totalChar; // 文件总字节数（通过计算）;
	public static String content;
	public int moveSkip = 0; // 跳转字符数；
	public int firstPageLineNum = 0; // 第一页行号数；
	public int secondPageLineNum;// 第二页行号数；
	public int thridPageLineNum;// 第三页行号数；
	public int lineCount;
	public int returnCurLine;// 返回百分比计算行数；
	public static boolean fileEnd = false;
	/** 从文件开头打开 */
	public static boolean fileFirstStart = false;
	/** 每页开头索引 */
	public static int markPoint;
	/** 每页末尾索引 */
	public static int pageEndPoint;
	/** 返回文件开头 */
	public static boolean returnFileStart = false;

	public static int pageMarkNum; // 页面首字符标记
	public int indexFont; // 字体变化后标记索引；
	public static float fileLength;// 文件大小；
	private static String fileNameStr, charSetStr;
	public short status = 3; // 状态判断。1表示向前计算正在运行。2表示向前计算结束。3表示数据已连接成功；
	public boolean isMark; // 是否


	public static void main(String args[]) {
		String content = null;
		BooksEngine engine = new BooksEngine();
		try {
			// engine.engineInit("c:\\text.txt", "宋体", 400, "GBK");
			engine.parseFile();
			for (int i = 0; i < 10; i++) {
				content = engine.getPageContent(252078, 10);
			}
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (UnsupportedEncodingException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		System.out.print("next line content:\n");
		System.out.println(content);
	}

	public int getCharWidth(String arg) {
		MeasureText measureText = new MeasureText(TextSizeUtil.fontSize);
		return (int) measureText.getCharWidth(arg);
	}

	/**
	 * init the file & other para 文件名 字体名 宽度 编码 in: fileName, fontName, width,
	 * charSet out: void
	 */
	public void engineInit(BookContentView bcv, String fontName, int width,
			String charSet) throws FileNotFoundException,
			UnsupportedEncodingException {
		screenWidth = width;
		fileNameStr = bcv.book.bookpath;
		charSetStr = charSet;
		try {
			if (bcv.book.fileLength > 0) {
				fileLength = bcv.book.fileLength;
			} else {
				fileLength = getFileSize(fileNameStr, charSet);
				BooksDao dao = BooksDao.getDao(bcv);
				ContentValues cv = new ContentValues();
				cv.put(DBHelper.FILE_LENGTH, fileLength);
				dao.update(DBHelper.TABLE_BOOK, bcv.book.id, cv);
			}
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		inputStreamReader = new InputStreamReader(new FileInputStream(
				fileNameStr), charSet);

		// 修改为与平台有关的
		/*
		 * font = new Font("宋体", Font.BOLD, 12); fontMetrics =
		 * gc.getFontMetrics(font);
		 */

		// font = new Font(Typeface.create(fontName, Typeface.BOLD), fontSize);
		bcv.bcHandler.sendEmptyMessage(3);
		return;
	}

	/**
	 * 获得所有字符数 analysis file
	 */
	public int getLineCount(int fontSize) {
		TextSizeUtil textSizeUtil = new TextSizeUtil();
		lineCount = textSizeUtil.fontSize;
		return lineCount;
	}

	public void parseFile() throws IOException {
		int readNum;
		int width = 0;
		String newString = null, oldString = new String("");
		int index = 0;
		boolean hasEnter = false;
		boolean hasEnoughWidth = false;

		int countCharNum = 0;

		lineIndex[0] = 0;
		while (true) {
			char buf[] = new char[MAX_BUF_SIZE];//
			readNum = inputStreamReader.read(buf, 0, MAX_BUF_SIZE);

			// file end
			if (readNum == -1) {
				break;
			}

			countCharNum += readNum;

			newString = new String(buf);

			// 读取一次的数据
			while (true) {
				newString = oldString + newString;
				oldString = new String("");
				width = 0;
				hasEnter = false;
				hasEnoughWidth = false;
				for (index = 0; index < newString.length(); index++) {
					// string 's width > screenWidth
					if (width > screenWidth) {
						hasEnoughWidth = true;
						break;
					}
					if (newString.charAt(index) == '\n') {
						hasEnter = true;
						break;
					}
					String text = newString.substring(index, index + 1);
					System.out.println("test-------------->" + text);
					width += getCharWidth(text);
				}

				// hasEnter || hasEnoughWidth
				if (hasEnter || hasEnoughWidth) {
					lineIndex[curLine + 1] = lineIndex[curLine] + index + 1;
					curLine++;
					index++;
					newString = newString.substring(index);
				}
				// don't have enough width
				else {
					oldString = newString;
					break;
				}
			}
		}

		this.totalChar = countCharNum;
	}

	/**
	 * 第三步调用，得到数据 get the page content in: page_no
	 */
	public String getPageContent(int lineNo, int lineCount)
			throws IndexOutOfBoundsException, IOException {
		StringBuffer strBuffer = new StringBuffer();
		long skipNum, retNum;
		int readNum;
		String Str = "    ";
		String tempStr;
		boolean lineEndFlag = false;
		int j = 0;
		System.out.println("getPageContent");
		System.out.println("lineNo" + lineNo);
		System.out.println("lineIndex[lineNo]" + lineIndex[lineNo]);
		System.out.println("curLine" + curLine);
		System.out.println("lineCount" + lineCount);
		if (lineNo >= curLine)
			return content = null;

		// reset the stream
		inputStreamReader = new InputStreamReader(new FileInputStream(
				fileNameStr), charSetStr);

		// skip the stream count n char

		skipNum = lineIndex[lineNo];
		do {
			retNum = inputStreamReader.skip(skipNum);
			skipNum -= retNum;
		} while (skipNum != 0);

		// get content

		for (int i = 0; i < lineCount; i++) {
			char buf[] = new char[MAX_BUF_SIZE];

			if (lineNo + i + 1 > curLine) {

				break;
			}
			readNum = inputStreamReader.read(buf, 0, lineIndex[lineNo + i + 1]
					- lineIndex[lineNo + i]);

			if (readNum == -1) {
				
				break;
			}
			/*
			 * if (buf[readNum - 1] == '\n') { lineEndFlag = true; // str +=
			 * (new String(buf, 0, readNum)); strBuffer.append(buf, 0, readNum);
			 * } else { if(lineEndFlag == true){
			 * 
			 * 
			 * strBuffer.append(Str); lineEndFlag = false; }else{ // str +=
			 * ((new String(buf, 0, readNum)) + '\n'); strBuffer.append(buf, 0,
			 * readNum); strBuffer.append('\n'); } }
			 */

			if (buf[readNum - 1] == '\n') {
				// str += (new String(buf, 0, readNum));
				strBuffer.append(buf, 0, readNum);
				
				if (j == 0) {
					markPoint = lineIndex[lineNo + i + 1];
				}
				j++;

			} else {
				// str += ((new String(buf, 0, readNum)) + '\n');
				strBuffer.append(buf, 0, readNum);
				strBuffer.append('\n');

			}

		}

		System.out.println("content++++++lineIndex[lineNo]++++++++++>"
				+ lineIndex[lineNo]);
		System.out.println("content++++++lineIndex[" + lineNo + "]++++++++++>"
				+ lineIndex[lineNo]);

		pageEndPoint = lineIndex[lineNo + lineCount - 1];
		content = new String(strBuffer);
		content = content.replace("\r", "");
		return content;
	}

	/**
	 * 通过百分比得到数据
	 * */
	public void parseFileByPercentage(int persent, int lineCount)
			throws IOException {

		int readNum;
		int width = 0;
		float temppersent;
		float fileLength;
		float tempnumber;
		long skipNumber;
		int searchNumber = 0;
		String newString = null, oldString = new String("");
		int index = 0;
		boolean hasEnter = false;
		boolean hasEnoughWidth = false;

		int countCharNum = 0;

		File fis = new File(fileNameStr);

		StatisFileChars statisFileChars = new StatisFileChars();
		fileLength = statisFileChars.statis(fileNameStr);

		// fileLength = fis.length();
		// System.out.println("fileLength" + fileLength);
		temppersent = (float) persent / 70.0f;
		// System.out.println("temppersent" + temppersent);
		tempnumber = fileLength * temppersent;
		// System.out.println("tempnumber" + tempnumber);
		skipNumber = Math.round(tempnumber);
		// System.out.println("skipNumber" + skipNumber);
		inputStreamReader.skip(skipNumber);

		while (true) {

			int i;

			char buf1[] = new char[1];
			readNum = inputStreamReader.read(buf1, 0, 1);
			searchNumber++;
			if (buf1[0] == '\n') {

				break;
			}
		}

		lineIndex[0] = 0;
		moveSkip = (int) skipNumber + searchNumber;
		while (true) {
			char buf[] = new char[MAX_BUF_SIZE];
			readNum = inputStreamReader.read(buf, 0, MAX_BUF_SIZE);

			// file end
			if (readNum == -1) {
				break;
			}

			countCharNum += readNum;

			newString = new String(buf);

			// 读取一次的数据
			while (true) {
				newString = oldString + newString;
				width = 0;
				hasEnter = false;
				hasEnoughWidth = false;
				// System.out.println("cruLine----newString---:" + newString);
				// System.out.println("cruLine----newString.length()---:" +
				// newString.length());
				for (index = 0; index < newString.length(); index++) {
					// string 's width > screenWidth
					if (width > screenWidth) {
						hasEnoughWidth = true;
						break;
					}
					if (newString.charAt(index) == '\n') {
						hasEnter = true;
						break;
					}
					String text = newString.substring(index, index + 1);
					width += getCharWidth(text);
				}

				// hasEnter || hasEnoughWidth
				if (hasEnter || hasEnoughWidth) {

					lineIndex[curLine + 1] = lineIndex[curLine] + index + 1;

					curLine++;
					index++;
					newString = newString.substring(index);
				}
				// don't have enough width
				else {
					oldString = newString;
					break;
				}
				if (curLine >= lineCount) {
					break;
				}
			}
		}
		moveSkip = moveSkip + lineIndex[curLine + 1];
		this.totalChar = countCharNum;
		// System.out.println("cruLine----lineIndex---:" + lineIndex[20]);
		// System.out.println("cruLine-------:" + curLine);
		// System.out.println("the char count of this file is:" + countCharNum);
		// System.out.println("the line count of this file is:" + curLine);

	}

	public String getMiddlePageContent(int lineCount)
			throws IndexOutOfBoundsException, IOException {
		String str = "";
		long retNum;
		int readNum;
		int lineNo = 0;

		if (lineNo >= curLine)
			return "";

		// reset the stream
		inputStreamReader = new InputStreamReader(new FileInputStream(
				fileNameStr), charSetStr);

		// skip the stream count n char
		// skipNum = lineIndex[lineNo];
		do {
			retNum = inputStreamReader.skip(moveSkip);
			moveSkip -= retNum;
		} while (moveSkip != 0);

		// get content

		for (int i = 0; i < lineCount; i++) {
			char buf[] = new char[MAX_BUF_SIZE];

			if (lineNo + i + 1 > curLine)
				break;
			// System.out.println("cruLine--"+i+"--lineIndex---:" +lineNo + i+1
			// );
			readNum = inputStreamReader.read(buf, 0, lineIndex[lineNo + i + 1]
					- lineIndex[lineNo + i]);

			if (readNum == -1)
				break;

			if (buf[readNum - 1] == '\n') {
				str += (new String(buf, 0, readNum));
			} else {
				str += ((new String(buf, 0, readNum)) + '\n');
			}
		}
		return content = str;
	}

	/**
	 * 第二步调用
	 * 
	 * @param persent
	 *            百分比 开始第一页为0 获得
	 * */
	public void parseFileByPercent(String fileNameStr, int persent,
			int lineCount) throws IOException {

		int readNum;
		int width = 0;
		float temppersent;

		float tempnumber;
		long skipNumber = 0;
		int searchNumber = 0;
		String newString = null, oldString = new String("");
		int index = 0;
		boolean hasEnter = false;
		boolean hasEnoughWidth = false;

		int countCharNum = 0;

		inputStreamReader2 = new InputStreamReader(new FileInputStream(
				fileNameStr), charSetStr);
		lineIndex[0] = 0;
		curLine = 0;
		if (persent != 0) {
			// fileLength = fis.length();
			System.out.println("fileLength" + fileLength);
			temppersent = (float) persent / 100.0f;
			System.out.println("persent" + persent);
			tempnumber = fileLength * temppersent;
			// System.out.println("tempnumber" + tempnumber);
			skipNumber = Math.round(tempnumber);
			// System.out.println("skipNumber" + skipNumber);
			inputStreamReader2.skip(skipNumber);
			System.out.println("--------while (true) {-------start----------");
			while (true) {
				int i;
				char buf1[] = new char[1];
				readNum = inputStreamReader2.read(buf1, 0, 1);
				searchNumber++;
				System.out.println("buf1[0]----------->" + buf1[0]);
				if (buf1[0] == '\n') {

					break;
				}
				if (readNum == -1) {

					break;
				}
			}
			moveSkip = (int) skipNumber + searchNumber;
			lineIndex[0] = moveSkip;
		}
		System.out.println("--------while (true) {------end-----------");
		// moveSkip = (int)skipNumber + searchNumber;
		System.out.println("--------moveSkip {------end-----------" + moveSkip);

		while (true) {
			char buf[] = new char[MAX_BUF_SIZE];
			readNum = inputStreamReader2.read(buf, 0, MAX_BUF_SIZE);

			// file end
			if (readNum == -1) {
				break;
			}

			countCharNum += readNum;

			newString = new String(buf);

			// 读取一次的数据
			while (true) {
				newString = oldString + newString;
				oldString = new String("");
				width = 0;
				if (hasEnter == true) {
					width = TextSizeUtil.fontSize;
				}
				hasEnter = false;
				hasEnoughWidth = false;

				for (index = 0; index < newString.length(); index++) {
					String text = newString.substring(index, index + 1);

					// if (newString.charAt(index) != '\r') {
					width += getCharWidth(text);
					// }
					// string 's width > screenWidth
					if (width > screenWidth - TextSizeUtil.fontSize) {
						hasEnoughWidth = true;
						break;
					}
					if (newString.charAt(index) == '\n') {
						hasEnter = true;
						break;
					}

				}

				// hasEnter || hasEnoughWidth

				if (hasEnter || hasEnoughWidth) {

					lineIndex[curLine + 1] = lineIndex[curLine] + index + 1;

					curLine++;
					index++;
					newString = newString.substring(index);

				} else {
					oldString = newString;
					break;
				}

				//当读取出来当前一页的内容时候，返回startDisp值，让显示线程开始启动；
				if(curLine == lineCount){
					ContentDisp.startDisp = true;
				}
				
				if (curLine >= 10 * lineCount) {
					moveSkip = moveSkip + lineIndex[curLine + 1];
					System.out
							.println("---------------------lineIndex[curLine]------------"
									+ lineIndex[curLine]);
					System.out
							.println("---------------------lineIndex[curLine + 1]------------"
									+ lineIndex[curLine + 1]);
					System.out
							.println("---------------------ParseEnd------------"
									+ curLine);
					// this.returnCurLine = curLine;
					this.pageMarkNum = lineIndex[0];
					System.out.println("lineIndex[1];" + lineIndex[1]);
					moveSkip = moveSkip + lineIndex[curLine + 1];
					this.totalChar = countCharNum;
					return;
				}
			}

		}

		return;
	}

	/** 文件首次打开是解析方法 */
	public void parseFileFirst(String fileNameStr, int lineCount)
			throws IOException {

		int readNum;
		int width = 0;

		String newString = null, oldString = new String("");
		int index = 0;
		boolean hasEnter = false;
		boolean hasEnoughWidth = false;
		fileFirstStart = true;
		int countCharNum = 0;

		inputStreamReader2 = new InputStreamReader(new FileInputStream(
				fileNameStr), charSetStr);

		System.out.println("--------while (true) {------end-----------");
		lineIndex[0] = 0;
		// moveSkip = (int)skipNumber + searchNumber;
		System.out.println("--------moveSkip {------end-----------" + moveSkip);

		while (true) {
			char buf[] = new char[MAX_BUF_SIZE];
			readNum = inputStreamReader2.read(buf, 0, MAX_BUF_SIZE);

			// file end
			if (readNum == -1) {
				break;
			}

			countCharNum += readNum;

			newString = new String(buf);

			// 读取一次的数据
			while (true) {
				newString = oldString + newString;
				oldString = new String("");
				width = 0;
				if (hasEnter == true) {
					width = TextSizeUtil.fontSize;
				}
				hasEnter = false;
				hasEnoughWidth = false;

				for (index = 0; index < newString.length(); index++) {
					String text = newString.substring(index, index + 1);

					// if (newString.charAt(index) != '\r') {
					width += getCharWidth(text);
					// }
					// string 's width > screenWidth
					if (width > screenWidth - TextSizeUtil.fontSize) {
						hasEnoughWidth = true;
						break;
					}
					if (newString.charAt(index) == '\n') {
						hasEnter = true;
						break;
					}

				}

				// hasEnter || hasEnoughWidth

				if (hasEnter || hasEnoughWidth) {

					lineIndex[curLine + 1] = lineIndex[curLine] + index + 1;

					curLine++;
					index++;
					newString = newString.substring(index);

				} else {
					oldString = newString;
					break;
				}
				//当读取出来当前一页的内容时候，返回startDisp值，让显示线程开始启动；
				if(curLine == lineCount){
					ContentDisp.startDisp = true;
				}
				if (curLine >= 10 * lineCount) {

					moveSkip = moveSkip + lineIndex[curLine + 1];
					System.out
							.println("---------------------lineIndex[curLine]------------"
									+ lineIndex[curLine]);
					System.out
							.println("---------------------lineIndex[curLine + 1]------------"
									+ lineIndex[curLine + 1]);
					System.out
							.println("---------------------ParseEnd------------"
									+ curLine);
					// this.returnCurLine = curLine;
					this.pageMarkNum = lineIndex[0];
					System.out.println("lineIndex[1];" + lineIndex[1]);
					moveSkip = moveSkip + lineIndex[curLine + 1];
					this.totalChar = countCharNum;
					return;
				}
			}

		}

		return;
	}

	public void parseFileBookMark(String fileNameStr, int markPoint,
			int lineCount) throws IOException {

		int readNum;
		int width = 0;
		long skipNumber = 0;

		String newString = null, oldString = new String("");
		int index = 0;
		boolean hasEnter = false;
		boolean hasEnoughWidth = false;

		int countCharNum = 0;
		moveSkip = markPoint;
		inputStreamReader2 = new InputStreamReader(new FileInputStream(
				fileNameStr), charSetStr);
		inputStreamReader2.skip(moveSkip);
		System.out.println("--------while (true) {------end-----------");
		lineIndex[0] = moveSkip;
		curLine = 0;
		System.out.println("--------moveSkip {------end-----------" + moveSkip);

		while (true) {
			char buf[] = new char[MAX_BUF_SIZE];
			readNum = inputStreamReader2.read(buf, 0, MAX_BUF_SIZE);

			// file end
			if (readNum == -1) {
				break;
			}

			countCharNum += readNum;

			newString = new String(buf);

			// 读取一次的数据
			while (true) {
				newString = oldString + newString;
				oldString = "";
				width = 0;
				if (hasEnter == true) {
					width = TextSizeUtil.fontSize;
				}
				hasEnter = false;
				hasEnoughWidth = false;

				for (index = 0; index < newString.length(); index++) {
					String text = newString.substring(index, index + 1);

					// if (newString.charAt(index) != '\r') {
					width += getCharWidth(text);
					// }
					// string 's width > screenWidth
					if (width > screenWidth - TextSizeUtil.fontSize) {
						hasEnoughWidth = true;
						break;
					}
					if (newString.charAt(index) == '\n') {
						hasEnter = true;
						break;
					}

				}

				// hasEnter || hasEnoughWidth

				if (hasEnter || hasEnoughWidth) {

					lineIndex[curLine + 1] = lineIndex[curLine] + index + 1;

					curLine++;
					index++;
					newString = newString.substring(index);

				} else {
					oldString = newString;
					break;
				}

				//当读取出来当前一页的内容时候，返回startDisp值，让显示线程开始启动；
				if(curLine == lineCount){
					ContentDisp.startDisp = true;
				}
				
				if (curLine >= 10 * lineCount) {
					moveSkip = moveSkip + lineIndex[curLine + 1];
					System.out
							.println("---------------------lineIndex[curLine]------------"
									+ lineIndex[curLine]);
					System.out
							.println("---------------------lineIndex[curLine + 1]------------"
									+ lineIndex[curLine + 1]);
					System.out
							.println("---------------------ParseEnd------------"
									+ curLine);
					this.returnCurLine = curLine;
					this.pageMarkNum = lineIndex[0];
					System.out.println("lineIndex[1];" + lineIndex[1]);
					moveSkip = moveSkip + lineIndex[curLine + 1];
					this.totalChar = countCharNum;
					return;
				}
			}

		}

		return;
	}

	// 解析字体大小改变；
	public void parseFileContentSize(String fileNameStr, int lineCount)
			throws IOException {

		int readNum;
		int width = 0;
		long skipNumber = 0;

		String newString = null, oldString = new String("");
		int index = 0;
		boolean hasEnter = false;
		boolean hasEnoughWidth = false;

		int countCharNum = 0;
		markPoint = markPoint;
		inputStreamReader2 = new InputStreamReader(new FileInputStream(
				fileNameStr), charSetStr);
		inputStreamReader2.skip(markPoint);
		System.out.println("--------while (true) {------end-----------");
		lineIndex[0] = markPoint;
		curLine = 0;
		System.out.println("--------moveSkip {------end-----------" + moveSkip);

		while (true) {
			char buf[] = new char[MAX_BUF_SIZE];
			readNum = inputStreamReader2.read(buf, 0, MAX_BUF_SIZE);

			// file end
			if (readNum == -1) {
				break;
			}

			countCharNum += readNum;

			newString = new String(buf);

			// 读取一次的数据
			while (true) {
				newString = oldString + newString;
				oldString = new String("");
				width = 0;
				if (hasEnter == true) {
					width = TextSizeUtil.fontSize;
				}
				hasEnter = false;
				hasEnoughWidth = false;

				for (index = 0; index < newString.length(); index++) {

					String text = newString.substring(index, index + 1);

					// if (newString.charAt(index) != '\r') {

					width += getCharWidth(text);

					// }
					// string 's width > screenWidth
					if (width > screenWidth - TextSizeUtil.fontSize) {
						hasEnoughWidth = true;
						break;
					}
					if (newString.charAt(index) == '\n') {
						hasEnter = true;
						break;
					}

				}

				// hasEnter || hasEnoughWidth

				if (hasEnter || hasEnoughWidth) {

					lineIndex[curLine + 1] = lineIndex[curLine] + index + 1;

					curLine++;
					index++;
					newString = newString.substring(index);

				} else {
					oldString = newString;
					break;
				}
				
				//当读取出来当前一页的内容时候，返回startDisp值，让显示线程开始启动；
				if(curLine == lineCount){
					ContentDisp.startDisp = true;
				}

				if (curLine >= 10 * lineCount) {
					moveSkip = moveSkip + lineIndex[curLine + 1];
					System.out
							.println("---------------------lineIndex[curLine]------------"
									+ lineIndex[curLine]);
					System.out
							.println("---------------------lineIndex[curLine + 1]------------"
									+ lineIndex[curLine + 1]);
					System.out
							.println("---------------------ParseEnd------------"
									+ curLine);
					this.returnCurLine = curLine;
					this.pageMarkNum = lineIndex[0];
					System.out.println("lineIndex[1];" + lineIndex[1]);
					moveSkip = moveSkip + lineIndex[curLine + 1];
					this.totalChar = countCharNum;
					return;
				}
			}

		}

		return;
	}

	/**
	 * 读完了getContent之后下一页
	 * 
	 * */
	public void parseFileNextPage(String fileNameStr, int lineCount)
			throws IOException {

		int readNum;
		int width = 0;

		String newString = null, oldString = new String("");
		int index = 0;
		boolean hasEnter = false;
		boolean hasEnoughWidth = false;

		int countCharNum = 0;
		inputStreamReader.skip(moveSkip);
		lineIndex[0] = 0;
		while (true) {
			char buf[] = new char[MAX_BUF_SIZE];//
			readNum = inputStreamReader.read(buf, 0, MAX_BUF_SIZE);

			// file end
			if (readNum == -1) {
				break;
			}

			countCharNum += readNum;

			newString = new String(buf);

			// 读取一次的数据
			while (true) {
				newString = oldString + newString;
				oldString = new String("");
				width = 0;
				if (hasEnter == true) {
					width = TextSizeUtil.fontSize;
				}
				hasEnter = false;
				hasEnoughWidth = false;
				for (index = 0; index < newString.length(); index++) {
					// string 's width > screenWidth
					if (width > screenWidth) {
						hasEnoughWidth = true;
						break;
					}
					if (newString.charAt(index) == '\n') {
						hasEnter = true;
						break;
					}
					String text = newString.substring(index, index + 1);
					width += getCharWidth(text);
				}

				// hasEnter || hasEnoughWidth
				if (hasEnter || hasEnoughWidth) {
					lineIndex[curLine + 1] = lineIndex[curLine] + index + 1;
					curLine++;
					index++;
					newString = newString.substring(index);
				}
				// don't have enough width
				else {
					oldString = newString;
					break;
				}
				if (curLine >= lineCount) {
					break;
				}
			}
		}

		moveSkip = moveSkip + lineIndex[curLine + 1];
		this.totalChar = countCharNum;

	}

	// 字体调整转换
	public void parseFileReturnPage(String fileNameStr, int lineCount)
			throws IOException {

		int readNum;
		int width = 0;
		String newString = null, oldString = new String("");
		int index = 0;
		boolean hasEnter = false;
		boolean hasEnoughWidth = false;

		/*
		 * pageMarkNum = pageMarkNum-10000; if(pageMarkNum<=0){ pageMarkNum =
		 * pageMarkNum }
		 */
		if (pageMarkNum > 10000) {
			pageMarkNum -= 10000;
		} else if (pageMarkNum <= 10000 && pageMarkNum > 5000) {
			pageMarkNum -= 5000;
		} else if (pageMarkNum <= 5000 && pageMarkNum > 3000) {
			pageMarkNum -= 3000;
		} else if (pageMarkNum <= 3000 && pageMarkNum > 1500) {
			pageMarkNum -= 1500;
		} else if (pageMarkNum <= 1500 && pageMarkNum > 150) {
			pageMarkNum -= 150;
		}

		int countCharNum = 0;
		inputStreamReader.skip(pageMarkNum);
		lineIndex[0] = 0;
		while (true) {
			char buf[] = new char[MAX_BUF_SIZE];//
			readNum = inputStreamReader.read(buf, 0, MAX_BUF_SIZE);

			// file end
			if (readNum == -1) {
				break;
			}

			countCharNum += readNum;

			newString = new String(buf);
			if (countCharNum >= 9980 && countCharNum <= 10060) {
				indexFont = curLine + 1;
			}
			// 读取一次的数据
			while (true) {
				newString = oldString + newString;
				oldString = new String("");
				width = 0;
				hasEnter = false;
				hasEnoughWidth = false;

				for (index = 0; index < newString.length(); index++) {
					// string 's width > screenWidth
					if (width > screenWidth) {
						hasEnoughWidth = true;
						break;
					}
					if (newString.charAt(index) == '\n') {
						hasEnter = true;
						break;
					}
					// width += getCharWidth(newString.charAt(index));
				}

				// hasEnter || hasEnoughWidth
				if (hasEnter || hasEnoughWidth) {
					lineIndex[curLine + 1] = lineIndex[curLine] + index + 1;
					curLine++;
					index++;
					newString = newString.substring(index);
				}
				// don't have enough width
				else {
					oldString = newString;
					break;
				}
				if (curLine >= lineCount) {
					break;
				}
			}
		}

		moveSkip = moveSkip + lineIndex[curLine + 1];
		this.totalChar = countCharNum;
	}

	// 向前返回
	public void parseFileReturna(String fileNameStr, int lineCount)
			throws IOException {
		System.out
				.println("-------------start return--------ParseEnd------------");
		int readNum;
		int width = 0;
		String newString = null, oldString = new String("");
		int index = 0;
		boolean hasEnter = false;
		boolean hasEnoughWidth = false;
		inputStreamReader2 = new InputStreamReader(new FileInputStream(
				fileNameStr), charSetStr);
		/*
		 * pageMarkNum = pageMarkNum-10000; if(pageMarkNum<=0){ pageMarkNum =
		 * pageMarkNum }
		 */
		int pageMarkNum1 = pageMarkNum;
		System.out
				.println("-------------pageMarkNum--------ParseEnd------------"
						+ pageMarkNum);

		if (pageMarkNum1 > 5000) {
			pageMarkNum1 -= 5000;
			System.out.println("***********pageMarkNum1*****************"
					+ pageMarkNum1);
		} else if (pageMarkNum1 <= 5000 && pageMarkNum1 > 3000) {
			pageMarkNum1 -= 3000;
		} else if (pageMarkNum1 <= 3000 && pageMarkNum1 > 1500) {
			pageMarkNum1 -= 1500;
			System.out.println("***********pageMarkNum1*****************"
					+ pageMarkNum1);
		} else if (pageMarkNum1 <= 1500 && pageMarkNum1 > 150) {
			pageMarkNum1 -= 150;
			System.out.println("***********pageMarkNum1*****************"
					+ pageMarkNum1);
		} else {
			pageMarkNum1 = 0;
		}
		System.out
				.println("-------------pageMarkNum1--------ParseEnd------------"
						+ pageMarkNum1);
		int countCharNum = 0;
		/*
		 * returnFileStart = false; if(pageMarkNum1 <= 1500){ pageMarkNum1 = 0;
		 * returnFileStart = true; }
		 */
		inputStreamReader2.skip(pageMarkNum1);
		int searchNumber = 0;
		while (true) {

			int i;

			char buf1[] = new char[1];
			readNum = inputStreamReader2.read(buf1, 0, 1);

			if (buf1[0] == '\n') {

				break;
			}
			if (readNum == -1) {

				break;
			}
			searchNumber++;
		}
		System.out
				.println("-------------pageMarkNum1--------ParseEnd------------"
						+ pageMarkNum1);
		moveSkip = (int) pageMarkNum1 + searchNumber;
		int moveCount = (int) pageMarkNum1 + searchNumber;
		lineIndex2 = new int[MAX_LINE_NUM];
		lineIndex2[0] = moveCount;
		curLine2 = 0;
		while (true) {
			char buf[] = new char[MAX_BUF_SIZE];//
			readNum = inputStreamReader2.read(buf, 0, MAX_BUF_SIZE);

			// file end
			if (readNum == -1) {
				this.status = 2;
				System.out.println("curLine2----readNum == -1-------->"
						+ curLine2);
				break;
			}
			readNum += readNum;

			countCharNum += readNum;

			newString = new String(buf);

			// 读取一次的数据
			while (true) {

				newString = oldString + newString;
				oldString = new String("");
				width = 0;
				hasEnter = false;
				hasEnoughWidth = false;
				moveCount = moveCount + index;

				for (index = 0; index < newString.length(); index++) {
					// System.out.println("-------------start return--------index------------"+index);
					// string 's width > screenWidth

					if (width > screenWidth - 5) {

						hasEnoughWidth = true;
						break;
					}

					if (newString.charAt(index) == '\n') {

						hasEnter = true;
						break;
					}

					String text = newString.substring(index, index + 1);

					// if (newString.charAt(index) != '\r') {
					width += getCharWidth(text);
					// }

				}

				// hasEnter || hasEnoughWidth

				if (hasEnter || hasEnoughWidth) {

					lineIndex2[curLine2 + 1] = lineIndex2[curLine2] + index + 1;
					System.out.println("return lineIndex2"
							+ lineIndex2[curLine2 + 1]);
					curLine2++;

					index++;
					newString = newString.substring(index);

				} else {
					oldString = newString;
					break;
				}

				if (lineIndex2[curLine2] >= pageMarkNum) {

					this.status = 2;
					moveSkip = moveSkip + lineIndex2[curLine2 + 1];
					return;
				}

			}

		}

		// moveSkip = moveSkip + lineIndex[curLine + 1];
		this.totalChar = countCharNum;

	}

	public void parseFileReturn(String fileNameStr, int lineCount)
			throws IOException {

		int readNum;
		int width = 0;

		int searchNumber = 0;
		String newString = null, oldString = new String("");
		int index = 0;
		boolean hasEnter = false;
		boolean hasEnoughWidth = false;

		int countCharNum = 0;

		inputStreamReader2 = new InputStreamReader(new FileInputStream(
				fileNameStr), charSetStr);
		int pageMarkNum1 = pageMarkNum;
		System.out
				.println("-------------pageMarkNum--------ParseEnd------------"
						+ pageMarkNum);

		if (pageMarkNum1 > 5000) {
			pageMarkNum1 -= 5000;
			System.out.println("***********pageMarkNum1*****************"
					+ pageMarkNum1);
		} else if (pageMarkNum1 <= 5000 && pageMarkNum1 > 3000) {
			pageMarkNum1 -= 3000;
		} else if (pageMarkNum1 <= 3000 && pageMarkNum1 > 1500) {
			pageMarkNum1 -= 1500;
			System.out.println("***********pageMarkNum1*****************"
					+ pageMarkNum1);
		} else if (pageMarkNum1 <= 1500 && pageMarkNum1 > 150) {
			pageMarkNum1 -= 150;
			System.out.println("***********pageMarkNum1*****************"
					+ pageMarkNum1);
		} else {
			pageMarkNum1 = 0;
		}

		inputStreamReader2.skip(pageMarkNum1);
		System.out.println("--------while (true) {-------start----------");
		while (true) {
			int i;
			char buf1[] = new char[1];
			readNum = inputStreamReader2.read(buf1, 0, 1);
			searchNumber++;
			System.out.println("buf1[0]----------->" + buf1[0]);
			if (buf1[0] == '\n') {

				break;
			}
			if (readNum == -1) {

				break;
			}
		}
		int moveSkips = (int) pageMarkNum1 + searchNumber;
		lineIndex2 = new int[MAX_LINE_NUM];
		curLine2 = 0;
		lineIndex2[0] = moveSkips;

		System.out.println("--------while (true) {------end-----------");
		// moveSkip = (int)skipNumber + searchNumber;
		System.out.println("--------moveSkip {------end-----------" + moveSkip);

		while (true) {
			char buf[] = new char[MAX_BUF_SIZE];
			readNum = inputStreamReader2.read(buf, 0, MAX_BUF_SIZE);

			// file end
			if (readNum == -1) {
				break;
			}

			countCharNum += readNum;

			newString = new String(buf);

			// 读取一次的数据
			while (true) {
				newString = oldString + newString;
				oldString = new String("");
				width = 0;
				if (hasEnter == true) {
					width = TextSizeUtil.fontSize;
				}
				hasEnter = false;
				hasEnoughWidth = false;

				for (index = 0; index < newString.length(); index++) {
					String text = newString.substring(index, index + 1);

					// if (newString.charAt(index) != '\r') {
					width += getCharWidth(text);
					// }
					// string 's width > screenWidth
					if (width > screenWidth - TextSizeUtil.fontSize) {
						hasEnoughWidth = true;
						break;
					}
					if (newString.charAt(index) == '\n') {
						hasEnter = true;
						break;
					}

				}

				// hasEnter || hasEnoughWidth

				if (hasEnter || hasEnoughWidth) {

					lineIndex2[curLine2 + 1] = lineIndex2[curLine2] + index + 1;

					curLine2++;
					index++;
					newString = newString.substring(index);

				} else {
					oldString = newString;
					break;
				}

				if (lineIndex2[curLine2] >= pageMarkNum) {

					this.status = 2;
					// moveSkip = moveSkip + lineIndex2[curLine2 + 1];
					return;
				}
			}

		}

		return;
	}

	// 计算接下来的行数
	public void parseFileNext(String fileNameStr, int lineCount)
			throws IOException {
		System.out.println("---------------------nextStart------------");
		int readNum;
		int width = 0;
		System.out.println("---nextStart---curLine---------" + curLine);

		System.out.println("---------------------nextStart------------");
		int shipPoint = this.lineIndex[curLine];
		System.out.println("--nextStart------" + (curLine - 2)
				+ "--shipPoint----" + lineIndex[curLine - 2]);
		System.out.println("--nextStart------" + (curLine - 1)
				+ "--shipPoint----" + lineIndex[curLine - 1]);
		System.out.println("--nextStart------" + (curLine) + "--shipPoint----"
				+ lineIndex[curLine]);
		System.out.println("--nextStart--------shipPoint----"
				+ lineIndex[curLine + 1]);
		System.out.println("--nextStart--------shipPoint----"
				+ lineIndex[curLine + 2]);

		String newString = null, oldString = new String("");
		int tempCurLines = curLine;
		int index = 0;
		boolean hasEnter = false;
		boolean hasEnoughWidth = false;
		int tempCurLine = 10 * lineCount + curLine;

		int countCharNum = 0;

		inputStreamReader2 = new InputStreamReader(new FileInputStream(
				fileNameStr), charSetStr);

		// fileLength = fis.length();
		System.out.println("lineIndex[1];" + lineIndex[1]);
		System.out.println("--nextStart--------shipPoint----" + shipPoint);
		inputStreamReader2.skip(shipPoint);
		curLine = this.curLine;
		lineIndex[curLine] = lineIndex[curLine];

		while (true) {
			char buf[] = new char[MAX_BUF_SIZE];
			readNum = inputStreamReader2.read(buf, 0, MAX_BUF_SIZE);

			// file end
			if (readNum == -1) {
				
				break;
			}

			countCharNum += readNum;

			newString = new String(buf);

			// 读取一次的数据
			while (true) {
				newString = oldString + newString;
				oldString = new String("");
				width = 0;
				if (hasEnter == true) {
					width = TextSizeUtil.fontSize;
				}
				hasEnter = false;
				hasEnoughWidth = false;

				for (index = 0; index < newString.length(); index++) {
					String text = newString.substring(index, index + 1);

					// if (newString.charAt(index) != '\r') {
					width += getCharWidth(text);
					// }
					// string 's width > screenWidth
					if (width > screenWidth - TextSizeUtil.fontSize) {
						hasEnoughWidth = true;
						break;
					}
					if (newString.charAt(index) == '\n') {
						hasEnter = true;
						break;
					}

				}

				// hasEnter || hasEnoughWidth

				if (hasEnter || hasEnoughWidth) {
					System.out.println("curLine" + curLine);
					System.out.println("lineIndex[curLine]"
							+ lineIndex[curLine]);
					lineIndex[curLine + 1] = lineIndex[curLine] + index + 1;
					System.out.println("lineIndex[curLine]"
							+ lineIndex[curLine + 1]);
					curLine++;

					index++;
					newString = newString.substring(index);

				} else {
					oldString = newString;
					break;
				}

				if (curLine >= tempCurLine) {
					moveSkip = moveSkip + lineIndex[curLine + 1];
					System.out
							.println("---------------------lineIndex[curLine]------------"
									+ lineIndex[curLine]);
					System.out
							.println("---------------------lineIndex[curLine + 1]------------"
									+ lineIndex[curLine + 1]);
					System.out
							.println("---------------------nextEnd------------"
									+ curLine);
					this.returnCurLine = curLine;
					this.pageMarkNum = lineIndex[1];
					System.out.println("lineIndex[1];" + lineIndex[1]);
					moveSkip = moveSkip + lineIndex[curLine + 1];
					this.totalChar = countCharNum;
					return;
				}
			}

		}

		return;
	}

	// 计算第零页

	public void parseFileZero(String fileNameStr, int lineCount)
			throws IOException {

		int readNum;
		int width = 0;
		float temppersent;

		float tempnumber;
		long skipNumber;
		int searchNumber = 0;
		String newString = null, oldString = new String("");
		int index = 0;
		boolean hasEnter = false;
		boolean hasEnoughWidth = false;

		int countCharNum = 0;

		inputStreamReader2 = new InputStreamReader(new FileInputStream(
				fileNameStr), charSetStr);

		System.out.println("--------while (true) {------end-----------");
		lineIndex3[0] = 0;

		System.out.println("--------moveSkip {------end-----------" + moveSkip);

		while (true) {
			char buf[] = new char[MAX_BUF_SIZE];
			readNum = inputStreamReader2.read(buf, 0, MAX_BUF_SIZE);

			// file end
			if (readNum == -1) {
				break;
			}

			countCharNum += readNum;

			newString = new String(buf);

			// 读取一次的数据
			while (true) {
				newString = oldString + newString;
				oldString = new String("");
				width = 0;
				if (hasEnter == true) {
					width = TextSizeUtil.fontSize;
				}
				hasEnter = false;
				hasEnoughWidth = false;

				for (index = 0; index < newString.length(); index++) {
					String text = newString.substring(index, index + 1);

					// if (newString.charAt(index) != '\r') {
					width += getCharWidth(text);
					// }
					// string 's width > screenWidth
					if (width > screenWidth - TextSizeUtil.fontSize) {
						hasEnoughWidth = true;
						break;
					}
					if (newString.charAt(index) == '\n') {
						hasEnter = true;
						break;
					}

				}

				// hasEnter || hasEnoughWidth

				if (hasEnter || hasEnoughWidth) {

					lineIndex3[curLine3 + 1] = lineIndex3[curLine3] + index + 1;

					curLine3++;
					index++;
					newString = newString.substring(index);

				} else {
					oldString = newString;
					break;
				}

				if (curLine3 >= lineCount) {
					// moveSkip = moveSkip + lineIndex3[curLine3 + 1];
					System.out
							.println("---------------------lineIndex3[curLine3]------------"
									+ lineIndex3[curLine3]);
					System.out
							.println("---------------------lineIndex3[curLine3 + 1]------------"
									+ lineIndex3[curLine3 + 1]);
					System.out
							.println("---------------------ParseEnd------------"
									+ curLine);
					this.returnCurLine = curLine;
					// this.pageMarkNum = lineIndex[1];
					System.out.println("lineIndex[1];" + lineIndex3[1]);
					// moveSkip = moveSkip + lineIndex[curLine3 + 1];
					// this.totalChar = countCharNum;
					return;
				}
			}

		}

		return;
	}

	/**
	 * 拖动条至百分百位置显示
	 * */
	public void parseFileMax(String fileNameStr, int lineCount)
	throws IOException {

		int readNum;
		int width = 0;
		
		int searchNumber = 0;
		String newString = null, oldString = new String("");
		int index = 0;
		boolean hasEnter = false;
		boolean hasEnoughWidth = false;
		
		int countCharNum = 0;
		
		inputStreamReader2 = new InputStreamReader(new FileInputStream(
				fileNameStr), charSetStr);
		int pageMarkNum1 = pageMarkNum;
		int shipCount = (int)fileLength - 3000;
		if(shipCount <= 0){
			shipCount = 0;
		}
		
		
		inputStreamReader2.skip(shipCount);
		System.out.println("--------while (true) {-------start----------");
		while (true) {
			int i;
			char buf1[] = new char[1];
			readNum = inputStreamReader2.read(buf1, 0, 1);
			searchNumber++;
			System.out.println("buf1[0]----------->" + buf1[0]);
			if (buf1[0] == '\n') {
		
				break;
			}
			if (readNum == -1) {
		
				break;
			}
		}
		int moveSkips = (int) shipCount + searchNumber;
		lineIndex4 = new int[MAX_LINE_NUM];
		curLine4 = 0;
		curLine = 24;
		lineIndex4[0] = moveSkips;
		
		System.out.println("--------while (true) {------end-----------");
		// moveSkip = (int)skipNumber + searchNumber;
		System.out.println("--------moveSkip {------end-----------" + moveSkip);
		
		while (true) {
			char buf[] = new char[MAX_BUF_SIZE];
			readNum = inputStreamReader2.read(buf, 0, MAX_BUF_SIZE);
		
			// file end
			
		
			countCharNum += readNum;
		
			newString = new String(buf);
		
			// 读取一次的数据
			while (true) {
				newString = oldString + newString;
				oldString = new String("");
				width = 0;
				if (hasEnter == true) {
					width = TextSizeUtil.fontSize;
				}
				hasEnter = false;
				hasEnoughWidth = false;
		
				for (index = 0; index < newString.length(); index++) {
					String text = newString.substring(index, index + 1);
		
					// if (newString.charAt(index) != '\r') {
					width += getCharWidth(text);
					// }
					// string 's width > screenWidth
					if (width > screenWidth - TextSizeUtil.fontSize) {
						hasEnoughWidth = true;
						break;
					}
					if (newString.charAt(index) == '\n') {
						hasEnter = true;
						break;
					}
		
				}
		
				// hasEnter || hasEnoughWidth
		
				if (hasEnter || hasEnoughWidth) {
		
					lineIndex4[curLine4 + 1] = lineIndex4[curLine4] + index + 1;
		
					curLine4++;
					index++;
					newString = newString.substring(index);
		
				} else {
					oldString = newString;
					break;
				}
		
				
			}
			if (readNum == -1) {
				
				int temp = curLine4;
				System.out.println("temp"+temp);
				
				int pageCount = temp/lineCount;
				int remainder = temp%lineCount;
				int pageIndex = remainder+pageCount*(lineCount);
				
				
				
				
				//
				System.arraycopy(lineIndex4, pageIndex-lineCount, lineIndex, 0,lineCount+1);
				for(int i=0;i<curLine4+2;i++){
					System.out.println("index4="+i+"="+lineIndex4[i]);
				}
				for(int i=0;i<curLine4+2;i++){
					System.out.println("index4="+i+"="+lineIndex[i]);
				}
				ContentDisp.startDisp = true;
				this.pageMarkNum = lineIndex[0];
				break;
			}
		}
		 
		return;
}

	// 获取第一页的数据

	public String getFirstPageContent(int lineNo, int lineCount)
			throws IndexOutOfBoundsException, IOException {
		StringBuffer strBuffer = new StringBuffer();
		long skipNum, retNum;
		int readNum;
		System.out.println("getPageContent");
		System.out.println("lineNo" + lineNo);
		System.out.println("curLine" + curLine);

		// reset the stream
		inputStreamReader = new InputStreamReader(new FileInputStream(
				fileNameStr), charSetStr);

		// skip the stream count n char
		skipNum = lineIndex3[lineNo];
		do {
			retNum = inputStreamReader.skip(skipNum);
			skipNum -= retNum;
		} while (skipNum != 0);

		// get content

		for (int i = 0; i < lineCount; i++) {
			char buf[] = new char[MAX_BUF_SIZE];

			readNum = inputStreamReader.read(buf, 0, lineIndex3[lineNo + i + 1]
					- lineIndex3[lineNo + i]);

			if (readNum == -1)
				break;

			if (buf[readNum - 1] == '\n') {
				// str += (new String(buf, 0, readNum));
				strBuffer.append(buf, 0, readNum);
			} else {
				// str += ((new String(buf, 0, readNum)) + '\n');
				strBuffer.append(buf, 0, readNum);
				strBuffer.append('\n');
			}
		}

		System.out.println("content++++++lineIndex[" + lineNo + "]++++++++++>"
				+ lineIndex[lineNo]);

		// System.out.println("pageMarkNum------------>"+pageMarkNum);
		System.out.println("curLine" + new String(strBuffer));
		content = new String(strBuffer);
		content = content.replaceAll("\r", "");
		return content;
	}

	public static int getFileSize(String fileNameStr, String charSetStr)
			throws IOException {
		int count = 0;

		inputStreamReader2 = new InputStreamReader(new FileInputStream(
				fileNameStr), charSetStr);

		while (true) {
			char bufs[] = new char[1024];

			int readNum = inputStreamReader2.read(bufs, 0, 1024);
			if (readNum == -1) {
				inputStreamReader2.close();
				break;
			}
			count = count + readNum;
		}
		return count;
	}

}
